home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2005 November
/
WNnov2005.iso
/
Windows
/
Indispensables
/
Movie Collection
/
MovieCollection5403.exe
/
{app}
/
php5
/
index.php
< prev
next >
Wrap
PHP Script
|
2005-04-21
|
3KB
|
81 lines
<?php
include_once('sql.class.php');
include_once('replace.class.php');
include_once('tools.class.php');
$mcsql= new TmcSql();
$doc = new DOMDocument();
$node = createDataPacket($doc);
$datapacket=$node;
// Liste des collections
$node = $doc->createElement('collections');
$rootnode = $node;
$tab = $mcsql->openSql('select idx, collection from t_collection');
foreach ($tab as $key => $row)
{
$node = $doc->createElement('collection');
$node->setAttribute("idx", $row['idx']);
$node->setAttribute("nom", utf8_encode($row['collection']));
$rootnode->appendChild($node);
}
$datapacket->appendChild($rootnode);
// Liste des catΘgories
$node = $doc->createElement('categories');
$rootnode = $node;
$tab = $mcsql->openSql('select idx, categorie from t_categorie');
foreach ($tab as $key => $row)
{
$node = $doc->createElement('categorie');
$node->setAttribute("idx", $row['idx']);
$node->setAttribute("nom", utf8_encode($row['categorie']));
$rootnode->appendChild($node);
}
$datapacket->appendChild($rootnode);
// VisibilitΘ du box office
$boxoffice = $_SESSION["mc_params"]->getBoxoffice();
if (!isset($boxoffice))
$boxoffice = 0;
$node = $doc->createElement('top10ajouts');
$node->setAttribute("boxoffice", $boxoffice);
$rootnode = $node;
$top10 = $_SESSION["mc_params"]->getTop10();
if (!isset($top10))
$top10 = 10;
$tab = $mcsql->openSql("select idx, dateajout, nom from t_film order by idx desc limit 0, {$top10}");
foreach ($tab as $key => $row)
{
$node = $doc->createElement('top10ajout');
$node->setAttribute("idx", $row['idx']);
$oDateStr = $row['dateajout'];
if (isset($oDateStr) and ($oDateStr!=''))
$oDateStr = ereg_replace("([0-9]{4})([0-9]{2})([0-9]{2})", '\\3/\\2/\\1', $oDateStr);
$node->setAttribute("dateajout", $oDateStr);
$node->setAttribute("nom", utf8_encode($row['nom']));
$rootnode->appendChild($node);
}
$datapacket->appendChild($rootnode);
$xsl = new DomDocument;
$xsl->load('./index.xsl');
$xsl_srce = $xsl->saveXML();
$replace = new TmcXslReplace($xsl_srce);
$xsl_srce = $replace->processReplace();
$xsl->loadxml($xsl_srce);
$proc = new xsltprocessor();
$proc->importStyleSheet($xsl); // Importation des rΦgles XSL
echo $proc->transformToXML($doc); // Transformation
//print $doc->saveXML();
?>